<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>GitHub风格任务看板</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        :root {
            --github-bg: #0d1117;
            --github-header: #161b22;
            --github-border: #30363d;
            --github-text: #c9d1d9;
            --github-text-secondary: #8b949e;
            --column-bg: #161b22;
            --card-bg: #21262d;
            --button-bg: #21262d;
            --button-hover: #30363d;
            --accent: #58a6ff;
            --todo: #f78166;
            --progress: #d29922;
            --done: #3fb950;
            --review: #a371f7;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
        }

        body {
            background-color: var(--github-bg);
            color: var(--github-text);
            line-height: 1.5;
            padding: 16px;
            min-height: 100vh;
        }

        .header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 16px;
            background-color: var(--github-header);
            border: 1px solid var(--github-border);
            border-radius: 6px;
            margin-bottom: 24px;
        }

        .logo {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .logo h1 {
            font-size: 20px;
            font-weight: 600;
        }

        .logo i {
            color: var(--accent);
            font-size: 28px;
        }

        .controls {
            display: flex;
            gap: 12px;
        }

        .btn {
            background-color: var(--button-bg);
            color: var(--github-text);
            border: 1px solid var(--github-border);
            border-radius: 6px;
            padding: 8px 16px;
            cursor: pointer;
            font-weight: 500;
            display: flex;
            align-items: center;
            gap: 6px;
            transition: all 0.2s;
        }

        .btn:hover {
            background-color: var(--button-hover);
        }

        .btn-primary {
            background-color: #238636;
            color: white;
        }

        .btn-primary:hover {
            background-color: #2ea043;
        }

        .container {
            display: flex;
            gap: 16px;
            overflow-x: auto;
            padding-bottom: 20px;
        }

        .column {
            background-color: var(--column-bg);
            border: 1px solid var(--github-border);
            border-radius: 6px;
            min-width: 300px;
            max-width: 300px;
            display: flex;
            flex-direction: column;
        }

        .column-header {
            padding: 16px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-bottom: 1px solid var(--github-border);
        }

        .column-title {
            display: flex;
            align-items: center;
            gap: 8px;
            font-weight: 600;
        }

        .badge {
            background-color: var(--github-border);
            color: var(--github-text);
            border-radius: 12px;
            padding: 2px 8px;
            font-size: 12px;
        }

        .todo .badge {
            background-color: var(--todo);
            color: black;
        }

        .progress .badge {
            background-color: var(--progress);
            color: black;
        }

        .review .badge {
            background-color: var(--review);
            color: white;
        }

        .done .badge {
            background-color: var(--done);
            color: black;
        }

        .column-content {
            padding: 16px;
            flex-grow: 1;
            overflow-y: auto;
            max-height: 70vh;
        }

        .card {
            background-color: var(--card-bg);
            border: 1px solid var(--github-border);
            border-radius: 6px;
            padding: 16px;
            margin-bottom: 12px;
            cursor: grab;
            transition: all 0.2s;
        }

        .card:hover {
            border-color: var(--accent);
        }

        .card-header {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            margin-bottom: 8px;
        }

        .card-title {
            font-weight: 600;
            font-size: 14px;
            margin-right: 8px;
        }

        .card-actions {
            display: flex;
            gap: 8px;
        }

        .card-action {
            color: var(--github-text-secondary);
            cursor: pointer;
            font-size: 14px;
        }

        .card-action:hover {
            color: var(--accent);
        }

        .card-body {
            font-size: 14px;
            color: var(--github-text-secondary);
            margin-bottom: 12px;
        }

        .card-footer {
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 12px;
            color: var(--github-text-secondary);
        }

        .card-meta {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .card-tag {
            background-color: var(--github-border);
            padding: 2px 8px;
            border-radius: 12px;
            font-size: 11px;
        }

        .add-card {
            color: var(--github-text-secondary);
            text-align: center;
            padding: 12px;
            cursor: pointer;
            border: 1px dashed var(--github-border);
            border-radius: 6px;
            transition: all 0.2s;
        }

        .add-card:hover {
            color: var(--accent);
            border-color: var(--accent);
        }

        .dragging {
            opacity: 0.5;
            transform: rotate(5deg);
        }

        /* 模态框样式 */
        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.7);
            z-index: 1000;
            justify-content: center;
            align-items: center;
        }

        .modal-content {
            background-color: var(--column-bg);
            border: 1px solid var(--github-border);
            border-radius: 6px;
            width: 100%;
            max-width: 500px;
            padding: 20px;
        }

        .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }

        .modal-title {
            font-weight: 600;
            font-size: 18px;
        }

        .modal-close {
            color: var(--github-text-secondary);
            cursor: pointer;
            font-size: 20px;
        }

        .modal-close:hover {
            color: var(--github-text);
        }

        .form-group {
            margin-bottom: 16px;
        }

        .form-label {
            display: block;
            margin-bottom: 6px;
            font-size: 14px;
            font-weight: 500;
        }

        .form-input, .form-textarea, .form-select {
            width: 100%;
            padding: 8px 12px;
            background-color: var(--github-bg);
            border: 1px solid var(--github-border);
            border-radius: 6px;
            color: var(--github-text);
            font-size: 14px;
        }

        .form-textarea {
            min-height: 100px;
            resize: vertical;
        }

        .form-actions {
            display: flex;
            justify-content: flex-end;
            gap: 12px;
            margin-top: 24px;
        }

        /* 响应式设计 */
        @media (max-width: 768px) {
            .container {
                flex-direction: column;
                align-items: center;
            }
            
            .column {
                min-width: 100%;
                max-width: 100%;
            }
            
            .header {
                flex-direction: column;
                gap: 16px;
                align-items: flex-start;
            }
            
            .controls {
                width: 100%;
                justify-content: space-between;
            }
        }
    </style>
</head>
<body>
    <header class="header">
        <div class="logo">
            <i class="fab fa-github"></i>
            <h1>GitHub任务看板</h1>
        </div>
        <div class="controls">
            <button class="btn" id="filterBtn">
                <i class="fas fa-filter"></i>筛选
            </button>
            <button class="btn" id="sortBtn">
                <i class="fas fa-sort"></i>排序
            </button>
            <button class="btn btn-primary" id="newTaskBtn">
                <i class="fas fa-plus"></i>新建任务
            </button>
        </div>
    </header>

    <div class="container" id="board">
        <!-- 待处理列 -->
        <div class="column todo" data-status="todo">
            <div class="column-header">
                <div class="column-title">
                    <i class="fas fa-clipboard-list"></i>
                    <span>待处理</span>
                    <span class="badge">3</span>
                </div>
                <i class="fas fa-ellipsis-h"></i>
            </div>
            <div class="column-content">
                <div class="card" draggable="true" data-id="1">
                    <div class="card-header">
                        <div class="card-title">修复登录页面UI问题</div>
                        <div class="card-actions">
                            <i class="fas fa-pencil-alt card-action"></i>
                            <i class="fas fa-times card-action"></i>
                        </div>
                    </div>
                    <div class="card-body">
                        登录按钮在移动设备上显示不完整，需要调整响应式布局。
                    </div>
                    <div class="card-footer">
                        <div class="card-meta">
                            <span>#1</span>
                            <span class="card-tag">UI</span>
                            <span class="card-tag">Bug</span>
                        </div>
                        <div class="card-assignee">
                            <i class="fas fa-user"></i>
                        </div>
                    </div>
                </div>
                <div class="card" draggable="true" data-id="2">
                    <div class="card-header">
                        <div class="card-title">实现用户注册API</div>
                        <div class="card-actions">
                            <i class="fas fa-pencil-alt card-action"></i>
                            <i class="fas fa-times card-action"></i>
                        </div>
                    </div>
                    <div class="card-body">
                        创建新用户注册的端点，包括电子邮件验证和密码加密。
                    </div>
                    <div class="card-footer">
                        <div class="card-meta">
                            <span>#2</span>
                            <span class="card-tag">后端</span>
                            <span class="card-tag">API</span>
                        </div>
                        <div class="card-assignee">
                            <i class="fas fa-user"></i>
                        </div>
                    </div>
                </div>
                <div class="add-card">
                    <i class="fas fa-plus"></i> 添加任务
                </div>
            </div>
        </div>

        <!-- 进行中列 -->
        <div class="column progress" data-status="progress">
            <div class="column-header">
                <div class="column-title">
                    <i class="fas fa-spinner"></i>
                    <span>进行中</span>
                    <span class="badge">2</span>
                </div>
                <i class="fas fa-ellipsis-h"></i>
            </div>
            <div class="column-content">
                <div class="card" draggable="true" data-id="3">
                    <div class="card-header">
                        <div class="card-title">设计数据库架构</div>
                        <div class="card-actions">
                            <i class="fas fa-pencil-alt card-action"></i>
                            <i class="fas fa-times card-action"></i>
                        </div>
                    </div>
                    <div class="card-body">
                        为用户管理系统设计高效的数据库模式，包括用户、角色和权限表。
                    </div>
                    <div class="card-footer">
                        <div class="card-meta">
                            <span>#3</span>
                            <span class="card-tag">数据库</span>
                        </div>
                        <div class="card-assignee">
                            <i class="fas fa-user"></i>
                        </div>
                    </div>
                </div>
                <div class="add-card">
                    <i class="fas fa-plus"></i> 添加任务
                </div>
            </div>
        </div>

        <!-- 审核中列 -->
        <div class="column review" data-status="review">
            <div class="column-header">
                <div class="column-title">
                    <i class="fas fa-eye"></i>
                    <span>审核中</span>
                    <span class="badge">1</span>
                </div>
                <i class="fas fa-ellipsis-h"></i>
            </div>
            <div class="column-content">
                <div class="card" draggable="true" data-id="4">
                    <div class="card-header">
                        <div class="card-title">编写用户文档</div>
                        <div class="card-actions">
                            <i class="fas fa-pencil-alt card-action"></i>
                            <i class="fas fa-times card-action"></i>
                        </div>
                    </div>
                    <div class="card-body">
                        创建新功能的用户使用指南和API文档。
                    </div>
                    <div class="card-footer">
                        <div class="card-meta">
                            <span>#4</span>
                            <span class="card-tag">文档</span>
                        </div>
                        <div class="card-assignee">
                            <i class="fas fa-user"></i>
                        </div>
                    </div>
                </div>
                <div class="add-card">
                    <i class="fas fa-plus"></i> 添加任务
                </div>
            </div>
        </div>

        <!-- 已完成列 -->
        <div class="column done" data-status="done">
            <div class="column-header">
                <div class="column-title">
                    <i class="fas fa-check"></i>
                    <span>已完成</span>
                    <span class="badge">2</span>
                </div>
                <i class="fas fa-ellipsis-h"></i>
            </div>
            <div class="column-content">
                <div class="card" draggable="true" data-id="5">
                    <div class="card-header">
                        <div class="card-title">项目初始化</div>
                        <div class="card-actions">
                            <i class="fas fa-pencil-alt card-action"></i>
                            <i class="fas fa-times card-action"></i>
                        </div>
                    </div>
                    <div class="card-body">
                        设置项目结构、版本控制和基础依赖。
                    </div>
                    <div class="card-footer">
                        <div class="card-meta">
                            <span>#5</span>
                            <span class="card-tag">基础</span>
                        </div>
                        <div class="card-assignee">
                            <i class="fas fa-user"></i>
                        </div>
                    </div>
                </div>
                <div class="add-card">
                    <i class="fas fa-plus"></i> 添加任务
                </div>
            </div>
        </div>
    </div>

    <!-- 新建任务模态框 -->
    <div class="modal" id="taskModal">
        <div class="modal-content">
            <div class="modal-header">
                <div class="modal-title">新建任务</div>
                <span class="modal-close">&times;</span>
            </div>
            <form id="taskForm">
                <div class="form-group">
                    <label class="form-label">标题</label>
                    <input type="text" class="form-input" placeholder="输入任务标题" required>
                </div>
                <div class="form-group">
                    <label class="form-label">描述</label>
                    <textarea class="form-textarea" placeholder="输入任务详细描述"></textarea>
                </div>
                <div class="form-group">
                    <label class="form-label">状态</label>
                    <select class="form-select">
                        <option value="todo">待处理</option>
                        <option value="progress">进行中</option>
                        <option value="review">审核中</option>
                        <option value="done">已完成</option>
                    </select>
                </div>
                <div class="form-group">
                    <label class="form-label">标签</label>
                    <input type="text" class="form-input" placeholder="输入标签，用逗号分隔">
                </div>
                <div class="form-actions">
                    <button type="button" class="btn" id="cancelTask">取消</button>
                    <button type="submit" class="btn btn-primary">创建任务</button>
                </div>
            </form>
        </div>
    </div>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            // 拖拽功能
            const cards = document.querySelectorAll('.card');
            const columns = document.querySelectorAll('.column-content');
            
            let draggedCard = null;
            
            cards.forEach(card => {
                card.addEventListener('dragstart', function() {
                    draggedCard = this;
                    setTimeout(() => {
                        this.classList.add('dragging');
                    }, 0);
                });
                
                card.addEventListener('dragend', function() {
                    this.classList.remove('dragging');
                    draggedCard = null;
                });
            });
            
            columns.forEach(column => {
                column.addEventListener('dragover', function(e) {
                    e.preventDefault();
                });
                
                column.addEventListener('dragenter', function(e) {
                    e.preventDefault();
                    this.style.backgroundColor = 'var(--github-border)';
                });
                
                column.addEventListener('dragleave', function() {
                    this.style.backgroundColor = '';
                });
                
                column.addEventListener('drop', function(e) {
                    e.preventDefault();
                    this.style.backgroundColor = '';
                    
                    if (draggedCard) {
                        this.insertBefore(draggedCard, this.querySelector('.add-card'));
                        updateBadgeCounts();
                    }
                });
            });
            
            // 模态框功能
            const modal = document.getElementById('taskModal');
            const newTaskBtn = document.getElementById('newTaskBtn');
            const closeModal = document.querySelector('.modal-close');
            const cancelTask = document.getElementById('cancelTask');
            const taskForm = document.getElementById('taskForm');
            
            newTaskBtn.addEventListener('click', function() {
                modal.style.display = 'flex';
            });
            
            closeModal.addEventListener('click', function() {
                modal.style.display = 'none';
            });
            
            cancelTask.addEventListener('click', function() {
                modal.style.display = 'none';
            });
            
            taskForm.addEventListener('submit', function(e) {
                e.preventDefault();
                const titleInput = this.querySelector('input[type="text"]');
                const descriptionInput = this.querySelector('textarea');
                const statusSelect = this.querySelector('select');
                
                if (titleInput.value.trim() !== '') {
                    addNewTask(titleInput.value, descriptionInput.value, statusSelect.value);
                    titleInput.value = '';
                    descriptionInput.value = '';
                    modal.style.display = 'none';
                }
            });
            
            // 点击外部关闭模态框
            window.addEventListener('click', function(e) {
                if (e.target === modal) {
                    modal.style.display = 'none';
                }
            });
            
            // 添加新任务
            function addNewTask(title, description, status) {
                const column = document.querySelector(`.column[data-status="${status}"] .column-content`);
                const cardId = Date.now(); // 使用时间戳作为唯一ID
                
                const newCard = document.createElement('div');
                newCard.className = 'card';
                newCard.draggable = true;
                newCard.dataset.id = cardId;
                
                newCard.innerHTML = `
                    <div class="card-header">
                        <div class="card-title">${title}</div>
                        <div class="card-actions">
                            <i class="fas fa-pencil-alt card-action"></i>
                            <i class="fas fa-times card-action"></i>
                        </div>
                    </div>
                    <div class="card-body">
                        ${description || '无描述'}
                    </div>
                    <div class="card-footer">
                        <div class="card-meta">
                            <span>#${cardId}</span>
                            <span class="card-tag">新功能</span>
                        </div>
                        <div class="card-assignee">
                            <i class="fas fa-user"></i>
                        </div>
                    </div>
                `;
                
                column.insertBefore(newCard, column.querySelector('.add-card'));
                
                // 添加拖拽事件
                newCard.addEventListener('dragstart', function() {
                    draggedCard = this;
                    setTimeout(() => {
                        this.classList.add('dragging');
                    }, 0);
                });
                
                newCard.addEventListener('dragend', function() {
                    this.classList.remove('dragging');
                    draggedCard = null;
                });
                
                // 添加删除功能
                const deleteBtn = newCard.querySelector('.fa-times');
                deleteBtn.addEventListener('click', function() {
                    newCard.remove();
                    updateBadgeCounts();
                });
                
                updateBadgeCounts();
            }
            
            // 更新列计数
            function updateBadgeCounts() {
                document.querySelectorAll('.column').forEach(column => {
                    const status = column.dataset.status;
                    const count = column.querySelectorAll('.card').length;
                    column.querySelector('.badge').textContent = count;
                });
            }
            
            // 添加删除卡片功能
            document.querySelectorAll('.card .fa-times').forEach(btn => {
                btn.addEventListener('click', function() {
                    this.closest('.card').remove();
                    updateBadgeCounts();
                });
            });
            
            // 添加卡片按钮事件
            document.querySelectorAll('.add-card').forEach(btn => {
                btn.addEventListener('click', function() {
                    const column = this.closest('.column');
                    const status = column.dataset.status;
                    
                    // 预设模态框中的状态
                    const statusSelect = document.querySelector('#taskModal select');
                    statusSelect.value = status;
                    
                    modal.style.display = 'flex';
                });
            });
        });
    </script>
</body>
</html>